/***************************************************************************
 *   Copyright (C) 2007 by Warren Kenny   				   *
 *   warren.kenny@gmail.com    						   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef GSCONFIGMANAGER_H
#define GSCONFIGMANAGER_H

#include <gsCore/gsCore.h>

#include <gsContainer/gsContainer.h>
#include <gsContainer/gsString.h>

#include <fstream>

class gsConfigManagerImpl
{
public:
       	
	/**
	 *        Method for passing command-line parameters to the configuration manager 
	 * @param argumentCount Number of arguments passed
	 * @param arguments Array of C-strings containing the arguments
	 */
	void setArguments( const gsInt argumentCount, const gsChar** arguments );
	
	/**
	 *        Method for setting the file path for the configuration file this configuration manager will use
	 * @param configFile Configuration file path
	 */
	void setFilePath( const gsString configFilePath );
	
	/**
	 *        Retrieves the configuration values for the given configuration string and stores them in the provided
	 *	  gsContainer
	 * @param configurationName The name string associated with the requested values
	 * @param configurationContainer A container into which all associated values should be stored
	 * @return 	True - If one or more configuration values were retrieved and stored in \a configurationContainer
	 *		False - If no configuration values are associated with the provided \a configurationName
	 */
	gsBool getConfiguration( const gsString configurationName, gsContainer<gsString>& configurationContainer );
	
    	/**
    	 *    Default Destructor
    	 */
    	~gsConfigManagerImpl();
	
protected:
	
	/**
	 *	Designates gsConfigManager singleton container as the only class capable of constructing instances of this class
	 */
	friend class gsConfigManager;
	
	/**
 	 * 	Default Constructor
	 */
	gsConfigManagerImpl();
	
	gsString m_configFilePath;

	gsInt m_argumentCount;
	
	const gsChar** m_arguments;
		
};

class gsConfigManager
{
public:
		
	/**
	 *        Gets the single instance of gsConfigManagerImpl from this singleton container class
	 * @return The single instance of gsConfigManagerImpl
	 */
	static gsConfigManagerImpl* getInstance();
	
	/**
	 *        Default destructor
	 */
	~gsConfigManager();
	
private:
	
	static gsConfigManagerImpl* m_manager;
};

#endif
